package com.mmy.service.ship.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mmy.dao.ship.TShipBaseRepository;
import com.mmy.dao.ship.VShipBaseRepository;
import com.mmy.domain.ship.TShipBase;
import com.mmy.domain.ship.VShipBase;
import com.mmy.service.ship.TShipBaseService;

@Service
public class TShipBaseServiceImpl implements TShipBaseService {

	@Autowired
	TShipBaseRepository tShipBaseRepository;
	@Autowired
	VShipBaseRepository vShipBaseRepository;

	/**
	 * 查找全部
	 * 
	 * @param
	 * @return
	 */
	public List<VShipBase> findAll() {
		// TODO Auto-generated method stub
		return vShipBaseRepository.findAll();
	}

	/**
	 * 获取最大值
	 * 
	 * @return 返回值说明 最大ID
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.17
	 */
	public int getMaxShipID() {
		// 流水号
		Object objCode = tShipBaseRepository.getMaxShipID();
		int iID = 0;
		if (objCode != null) {
			iID = Integer.parseInt(objCode.toString());
		}
		return iID;
	}

	/**
	 * 新增id
	 * 
	 * @param
	 * @return
	 */
	public void save(int shipID) {
		// TODO Auto-generated method stub
		tShipBaseRepository.save(shipID);
	}

	/**
	 * 新增
	 * 
	 * @param
	 * @return
	 */
	public void save(TShipBase tShipBase) {
		// TODO Auto-generated method stub
		tShipBaseRepository.save(tShipBase);
	}

	/**
	 * 删除
	 * 
	 * @param
	 * @return
	 */
	public void delShipBase(List<Integer> lstShipID) {
		// TODO Auto-generated method stub
		tShipBaseRepository.delShipBase(lstShipID);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public TShipBase findByShipID(int iShipID) {
		// TODO Auto-generated method stub
		return tShipBaseRepository.findByShipID(iShipID);
	}

	/**
	 * 通过name查找
	 * 
	 * @param
	 * @return
	 */
	public List<VShipBase> findByName(String strShipName) {
		// TODO Auto-generated method stub
		return vShipBaseRepository.findByName(strShipName);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public VShipBase findByID(int iShipID) {
		// TODO Auto-generated method stub
		return vShipBaseRepository.findByID(iShipID);
	}

}
